import request from '../api';
import qs from 'qs';

export const getUnCheckList = async (token) => {
  return await request.request({
    url: `/checkinList?token=${token}`,
    method: 'GET',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
};

export const getCheckedList = async (token) => {
  return await request.request({
    url: `/checkinList?token=${token}`,
    method: 'GET',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
};

export const getTypeList = async (token) => {
  return await request.request({
    url: `/checkIntypeList?token=${token}`,
    method: 'GET',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
};
// /setCheckinStatus?token=x&status=x&score=x
export const setCheckInStatus = async (token, id, status, score) => {
  return await request.request({
    url: `/setCheckinStatus?token=${token}`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify({
      id,
      status,
      score
    })
  });
};